from selenium import webdriver
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By
from time import sleep

driver = webdriver.Chrome()
url = 'https://getbootstrap.net/example/checkout/'
driver.get(url)
driver.maximize_window()
sleep(2)

# 获取页面高度 使页面下拉
body = driver.find_element(By.TAG_NAME, 'body')
body.send_keys(Keys.PAGE_DOWN)
sleep(1)

# 获取元素
select = driver.find_element(By.ID, 'country')
options = select.find_elements(By.TAG_NAME, 'option')
# 选中文本是'United States'的选项
for option in options:
    if option.text == 'United States':
        option.click()

sleep(2)
driver.close()
print('...')